package common;

import java.util.ResourceBundle;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;

/**
 * @author Giang Nguyen
 *
 */
public class InitConfig extends HttpServlet {

    private String encoding;

    public void init(ServletConfig config) throws ServletException {
        super.init(config);
//        Constant.CONTEXT_PATH = config.getServletContext().getContextPath();
        Constant.CONFIG = ResourceBundle.getBundle("config");

        encoding = config.getInitParameter("requestEncoding");
	if( encoding==null ) encoding="UTF-8";

	Constant.SETTING_RES = ResourceBundle.getBundle("setting");
//	Constant.PATH_RES = ResourceBundle.getBundle("path");
//	Constant.SQL_RES = ResourceBundle.getBundle("sql");
//	Constant.MESSAGE_RES = ResourceBundle.getBundle("i18n");
	System.out.println("InitConfig is initialized successfully!");

    }
}
